﻿using furion.blog.Domain.MySQL;
using furion.blog.Domain.Shared.Dto.Dept;
using Furion.DependencyInjection;
using Mapster;
using MapsterMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace furion.blog.Application.CustomMapper
{
    public class DeptMapper : Mapper , IRegister, ISingleton
    {
        public void Register(TypeAdapterConfig config)
        {
            config.ForType<DeptUpdateDto, Dept>()
            .Map(dest => dest.ParentId, source => source.ParentId)
            .Map(dest => dest.DeptName, source => source.DeptName)
            .Map(dest => dest.DeptEn, source => source.DeptEn)
            .Map(dest => dest.Leader, source => source.Leader)
            .Map(dest => dest.Phone, source => source.Phone)
            .Map(dest => dest.Ancestors, source => source.Ancestors)
            .Map(dest => dest.OrderNum, source => source.OrderNum)
           .Map(dest => dest.UpdatedBy, source => source.UpdatedBy)
           .Map(dest => dest.UpdatedTime, source => source.UpdatedTime)
           .IgnoreNonMapped(true);
        }
    }
}
